<template>
    <div class="dialoglistDiv">
        <div class="table_box"><div class="table_" id="tb">
            <ul class="head">
                <li class="liflex">企业名称</li>
                <li class="liflex wcen">报名时间</li>
                <li class="liflex wcen">审核状态</li>
                <li class="liflex wcen">审核时间</li>
                <li class="liaction li4">操作</li>
            </ul>
            <div class="body">
                <ul v-for="x in obj.ary" :key="x">
                    <li class="liflex">{{x.companyname}}</li>
                    <li class="liflex wcen">{{x.intime}}</li>
                    <li class="liflex wcen">
                        <div :class="[globalData.verifyTypeAry2[x.verify_state].label]">{{globalData.verifyTypeAry2[x.verify_state].text}}</div>
                    </li>
                    <li class="liflex wcen">{{x.verify_time}}</li>
                    <li class="liaction li4">
                        <DelConfirm class="" isclass="edit_btn" buttontype="success" @yesClick="del(x)" :disabled="x.verify_state=='1'" title="确认报名成功吗？" text="确认" yes="通过" />
                    </li>
                </ul>
            </div>
        </div>
        </div><Pager :value="obj.req" :init="init" />
    </div>
</template>

<script setup>
    import { reactive, getCurrentInstance, ref, toRefs, provide, computed } from 'vue'
    import Pager from '@/components/pager.vue'
    import DelConfirm from '@/components/del_confirm.vue'
    let { proxy } = getCurrentInstance()
    const props = defineProps({
        train_id: { type: String },
        day: { type: String }
    })

    let obj = reactive({
        ary: [],
        req: {
            currentpage: 1,
            pagesize: 10,
            count: 0,
            train_id: props.train_id,
        }
    });
    let init = () => {
        proxy.$ajax({
            url: 'train/company',
            data: obj.req,
            bfLoading: true
        }).then(d => {
            // console.log(d)
            if(d.success){
                obj.ary = d.msg.list
                obj.req.count = d.msg.count
            }
        }).catch(() => { })
    }

    const del = x =>{
        proxy.$ajax({
            url: '/train/company_verify',
            data: { sign_id: x.sign_id , train_id: props.train_id},
            bfLoading: true
        }).then(d => {
            // console.log(d)
            if(d.success){
                proxy.elMessageMixin("审核成功", 'success')
                init()
            }else{
                proxy.elMessageMixin(d.err, 'error')
            }
        }).catch(() => { })
    }

</script>

<style scoped>
    ::-webkit-scrollbar { width:10px; background-color: #FFFFFF; }
    .listDiv { top:70px; }
    #tb ul li.li2 { width: 70px; }
    #tb ul li.li3 { width: 70px; }
    #tb ul li.li4 { width: 100px; }
</style>